<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ page import="com.utbm.lo54.entity.Course"%>
<%@ page import="com.utbm.lo54.entity.Location"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel=stylesheet type="text/css" href="design.css">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Training Course Manager Website</title>
 <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
 <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
 <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
 <script>
  $(function() {
    $( "#datepicker" ).datepicker();
    var currentDate = $( ".selector" ).datepicker( "getDate" );
  });
  </script>
</head>
<body>

	<h1>List of available courses : </h1>
	<p><strong><u>Filters :</u></strong></p>
	<form method="POST" name="myform" action="CatalogueServlet">
		Key Word :<input type="text" name="key" /> <br /> Date :<input type="text"
			name="date" id ="datepicker" /><br /> Location : <select name="location" size="1">
			<option selected>
				All
				<c:forEach var="location" items="${locations}">
					<option>
						<c:out value="${location.getCity()}" />
				</c:forEach>
		</select> <input type="submit" value="Filter" />
	</form>
	<br />
	<br />
	<p><strong><u>Available courses :</u></strong></p>
	<table border="1">
		<tr>
			<TH>Code</TH>
			<TH>Name</TH>
			<TH>Details</TH>
		</tr>
		<c:forEach var="course" items="${courses}">
			<c:set var="courseCode">${course.getCode()}</c:set>
			<tr>
				<td><c:out value="${course.getCode()}" /></td>
				<td><c:out value="${course.getTitle()}" /></td>
				<td><a
					href="http://localhost:8080/LO54_Project/SessionServlet?course=${courseCode}">Sessions</a>

				</td>
			</tr>
		</c:forEach>
	</table>
</body>
</html>
